﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Threading;
using Cad;

namespace Tests
{
    public class Program
    {
        static void Main()
        {

            Cad.CAD proc = new Cad.CAD();
            
            Process process = Process.GetCurrentProcess();

            Console.WriteLine("Memoire physique allouée : " + process.WorkingSet64);

            PerformanceCounter cpuCounter;
            PerformanceCounter ramCounter;

            cpuCounter = new PerformanceCounter();

            cpuCounter.CategoryName = "Processor";
            cpuCounter.CounterName = "% Processor Time";
            cpuCounter.InstanceName = "_Total";

            ramCounter = new PerformanceCounter("Memory", "Available MBytes");

            Console.WriteLine(cpuCounter.NextValue() + "%"); //getCurrentCpuUsage
            Console.WriteLine(ramCounter.NextValue() + "Mb"); //getAvailableRAM
            Thread.Sleep(1000);
            int cpu = 0;
            int ram = 0;
            cpu = (int)cpuCounter.NextValue();
            Console.WriteLine(cpu);
            ram = (int)ramCounter.NextValue();
            Console.WriteLine(ram);
            Console.WriteLine(cpu +" "+ ram);
            DateTime now = new DateTime();
            now = DateTime.Now;

            
            proc.StockedProcedureExec(cpu, ram, now);

            Console.Read();

        }
    }

}
